package com.yc.thread.conpro;

public class Provider implements Runnable{

    public Info info = null;

    public Provider(Info info){
        this.info=info;
    }

    @Override
    public synchronized void run() {
        boolean flag = true;
        for (int i = 0; i < 5; i++) {
            if (flag) {
                this.info.set("面包","正在生产。。。");
                flag = false;
            } else {
                this.info.set("面包","被消费了。。");
                flag = true;
            }
        }
    }
}
